import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

public class QueryTheRecord implements ActionListener {
    private JLabel label, label2, label3, label4, label5, label6, label7, label8, label9, label111, label222;
    private JButton button;
    private JPanel panel, panel2, allpanel;
    private JFrame window;
    private JFrame pre;

    public static void main(String[] args) throws IOException {
        new QueryTheRecord(null);
    }

    public QueryTheRecord(JFrame jf) throws IOException {
        pre = jf;
        window = new JFrame("个人详情");
        label = new JLabel("您的账户");
        label2 = new JLabel(Choice.n);
        label111 = new JLabel("您的盈亏");
        label222 = new JLabel("0");
        label3 = new JLabel("获胜场次");
        label4 = new JLabel("number");
        label5 = new JLabel("匹配场次");
        label6 = new JLabel("number");
        label7 = new JLabel("您的胜率");
        label8 = new JLabel("number");
        label9 = new JLabel("您的个人详情");
        panel = new JPanel();
        panel2 = new JPanel();
        allpanel = new JPanel();
        button = new JButton("返回");
        button.addActionListener(this);
        panel.add(label);
        panel.add(label2);
        panel.add(label3);
        panel.add(label4);
        panel.add(label5);
        panel.add(label6);
        panel.add(label7);
        panel.add(label8);
        panel.add(label111);
        panel.add(label222);
        panel.add(button);
        panel2.add(label9);
        Font f1 = new Font("微软雅黑", Font.PLAIN, 24);
        label.setFont(f1);
        label2.setFont(f1);
        label111.setFont(f1);
        label222.setFont(f1);
        label3.setFont(f1);
        label4.setFont(f1);
        label5.setFont(f1);
        label6.setFont(f1);
        label7.setFont(f1);
        label8.setFont(f1);
        label9.setFont(new Font("微软雅黑", Font.BOLD, 36));
        button.setFont(f1);

        // panel.setLayout(new FlowLayout(FlowLayout.LEFT,35,15));

        /*
         * GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout);
         * layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true);
         * GroupLayout.SequentialGroup hSequentialGroup =
         * layout.createSequentialGroup().addComponent(label) .addComponent(label2);
         * GroupLayout.SequentialGroup hSequentialGroup2 =
         * layout.createSequentialGroup().addComponent(label3) .addComponent(label4);
         * GroupLayout.SequentialGroup hSequentialGroup3 =
         * layout.createSequentialGroup().addComponent(label5) .addComponent(label6);
         * GroupLayout.SequentialGroup hSequentialGroup4 =
         * layout.createSequentialGroup().addComponent(label7) .addComponent(label8);
         * GroupLayout.ParallelGroup hGroup =
         * layout.createParallelGroup().addGroup(hSequentialGroup)
         * .addGroup(hSequentialGroup2).addGroup(hSequentialGroup3).addGroup(
         * hSequentialGroup4) .addComponent(button, Alignment.CENTER);
         * layout.setHorizontalGroup(hGroup); GroupLayout.ParallelGroup vParallelGroup =
         * layout.createParallelGroup(Alignment.CENTER).addComponent(label)
         * .addComponent(label2); GroupLayout.ParallelGroup vParallelGroup2 =
         * layout.createParallelGroup(Alignment.CENTER).addComponent(label3)
         * .addComponent(label4); GroupLayout.ParallelGroup vParallelGroup3 =
         * layout.createParallelGroup(Alignment.CENTER).addComponent(label5)
         * .addComponent(label6); GroupLayout.ParallelGroup vParallelGroup4 =
         * layout.createParallelGroup(Alignment.CENTER).addComponent(label7)
         * .addComponent(label8); GroupLayout.SequentialGroup vGroup =
         * layout.createSequentialGroup().addGroup(vParallelGroup)
         * .addGroup(vParallelGroup2).addGroup(vParallelGroup3).addGroup(vParallelGroup4
         * ).addComponent(button); layout.setVerticalGroup(vGroup);
         */

        FlowLayout layout = new FlowLayout(FlowLayout.CENTER);
        panel.setLayout(layout);
        layout.setHgap(600);

        BorderLayout layout2 = new BorderLayout();
        allpanel.setLayout(layout2);
        allpanel.add(panel, BorderLayout.CENTER);
        allpanel.add(panel2, BorderLayout.NORTH);

        window.setBounds(520, 100, 1440, 810);
        window.setVisible(true);
        window.setResizable(false);
        window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        window.setContentPane(allpanel);
        window.setLocationRelativeTo(null);
        String money = Test.link.readLine();
        label222.setText(money);
        String win = Test.link.readLine();
        label4.setText(win);
        String games = Test.link.readLine();
        label6.setText(games);
        double winRate = (double) Integer.parseInt(win) * 100 / (double) Integer.parseInt(games);
        label8.setText(winRate + "%");
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == button) {
            pre.setVisible(true);
            window.setVisible(false);
        }
    }
}
